package com.dongyoufa.senior1.week1.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dongyoufa.senior1.week1.dao.ReimburseDao;
import com.dongyoufa.senior1.week1.entity.Dept;
import com.dongyoufa.senior1.week1.entity.Reimburse;
import com.dongyoufa.senior1.week1.service.ReimburseService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sun.tools.corba.se.idl.constExpr.And;
@Service
public class ReimburseServiceImpl implements ReimburseService{
	@Autowired
	private ReimburseDao reimburseDao;
	public PageInfo<Reimburse> getlist(Integer pageNum, Integer pageSize, Reimburse reimburse) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, pageSize);
		List<Reimburse> reimburses = reimburseDao.getlist(reimburse);
		PageInfo<Reimburse> pageInfo = new PageInfo<Reimburse>(reimburses);
		return pageInfo;
	}
	public List<Dept> xiala() {
		// TODO Auto-generated method stub
		List<Dept> depts = reimburseDao.xiala();
		return depts;
	}
	public Reimburse getid(String id) {
		// TODO Auto-generated method stub
		Reimburse reimburse = reimburseDao.getid(id);
		return reimburse;
	}
	public void toinsert(Reimburse reimburse) {
		// TODO Auto-generated method stub
		if (reimburse.getReimburseId()!=null && reimburse.getReimburseId()!="") {
			reimburseDao.delete(reimburse.getReimburseId());
			reimburseDao.insert(reimburse);
		}
		System.out.println("=========================================");
	}
	public void delete(String id) {
		// TODO Auto-generated method stub
		System.out.println(id+"=========231231231231231==================");
		reimburseDao.delete(id);
	}

}
